"use client"
import Content from '@/app/admin/page'
import React, { useEffect, useState } from 'react';
import { message, Tabs } from 'antd';

import { getUsers, updUser } from '@/api/usersApi'
import Carousel from './components/Carousel'
import Present from './components/Present'
import Contact from './components/Contact'
export default function Home() {
  const [data, setData] = useState([]);

  const Init = async () => {
    const res = await getUsers()
    if(res?.flag){
      setData(res.data)
    }else{
      message.error('服务器未响应');
    }
  }
  useEffect(() => {
    // Init()
  }, [])

  const items = [
    {
      key: '1',
      label: '轮播图',
      children: <Carousel></Carousel>,
    },
    {
      key: '2',
      label: '公司介绍',
      children: <Present></Present>,
    },
    {
      key: '3',
      label: '联系方式',
      children: <Contact></Contact>,
    },
  ];
  const onChange = (key: string) => {
    console.log(key);
  };
  return (<Content>
    <div
      style={{
        padding: 24,
        minHeight: 360,
        background: '#fff',
        borderRadius: 10,
        flex: 1,
        overflow: 'auto'
      }}
    >
      <Tabs defaultActiveKey="1" items={items} onChange={onChange} />
    </div>
  </Content>
  );
};
